/*******************************************************************************
**
** Copyright (c) 2011 - The OWE Team
**
** This file is part of OWE.
**
** OWE is a free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; version
** version 2.1 of the License.
**
** OWE is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with OWE. If not, see <http://www.gnu.org/licenses/>.
**
*******************************************************************************/

#ifndef NODE_H
#define NODE_H

#include <owe/global.h>

OWE_BEGIN_NAMESPACE

class UString;

/*!
    \class Node
    \brief XML node wrapper.

    \ingroup Configuration

    This class hides the backend XML parser implementation. In order to share as
    much as possible of code in all supported platforms, during a element
    creation, the Element class will ask the Node for attributes. The other
    approach would be let the parser set the element attributes, but this setter
    code might end being duplicated in every backend.
*/
class OWE_EXPORT Node
{
public:
    /*!
        Destructs the object releasing all allocated resources.
    */
    virtual ~Node() {};

    /*!
        Return the node name, i.e the tag.
    */
    virtual UString name() const = 0;

    /*!
        Return a node attribute based on the \a attributeName. An empty string
        is returned if the attribute was not found.
    */
    virtual UString attribute(const char* attributeName) const = 0;

    /*!
        Return the node data or an empty string if the node has no data. Used
        only by text nodes.

        \sa TextElement
    */
    virtual UString data() const = 0;
};

OWE_END_NAMESPACE

#endif // NODE_H
